<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/fmt.tld" %>
<c:if test="${obj == null}">
	<center><h2>该订单不存在</h2></center>
</c:if>
<c:if test="${obj != null}">
	<form action="${contextPath }/admin/order/update.do" method="post">
	<input type="hidden" name="o.id" value="${obj.id }">
<div>
	<table width="80%" align="center" border="1" bordercolor="#CCC">
	<caption>订单详情</caption>
	<tr align="center" height="30">
		<td>产品名称</td><td>产品价格</td><td>产品数量</td><td>小计</td>
	</tr>
	<c:set var="total" value="0"/>
	<c:forEach items="${obj.orderInfos}" var="o">
		<tr align="center" height="30"><td>${o.product.productName } </td>
			<td>${o.product.price }</td>
			<td>${o.productnum }</td>
			<td>${o.productnum * o.product.price }</td>
			<c:set var="total" value="${total + o.productnum * o.product.price }"/>
		</tr>
	</c:forEach>
	<tr height="30">
		<td colspan="3" align="right">总计</td><td align="center">￥ ${total }</td>
	</tr>
	<tr height="30">
	</tr>
	<tr height="30">
		<td colspan="3" align="right">订单状态</td>
		<td align="center">
			<select name="o.state">
				<c:if test="${obj.state == 0}">
			    	<option value="0" selected="selected">未付款</option>
			    </c:if>
			    <c:if test="${obj.state != 0 }">
			    	<option value="0" >未付款</option>
			    </c:if>
			    <c:if test="${obj.state == 1}">
			    	<option value="1" selected="selected">正在处理</option>
			    </c:if>
			    <c:if test="${obj.state != 1}">
			    	<option value="1" >正在处理</option>
			    </c:if>
			    <c:if test="${obj.state == 2}">
			    	
			    	<option value="2" selected="selected">已付款</option>
			    </c:if>
			    <c:if test="${obj.state != 2}">
			    	<option value="2" >已付款</option>
			    </c:if>
			    <c:if test="${obj.state == 3}">
			    	<option value="3" selected="selected">已发货</option>
			    </c:if>
			    <c:if test="${obj.state != 3}">
			    	<option value="3" >已发货</option>
			    </c:if>
			    <c:if test="${obj.state == 4}">
			    	完成
			    	<option value="4" selected="selected">完成</option>
			    </c:if>
			    <c:if test="${obj.state != 4}">
			    	完成
			    	<option value="4">完成</option>
			    </c:if>
			</select>
		</td>
	</tr>
	</table>
</div>
<div style="margin-left:75px;margin-top:30px;line-height:26px;">
	
	<h3>收货人信息:</h3>
	<p>收货地址：<input name="o.address" value="${obj.address}"/></p>
	<p>收&nbsp;&nbsp;获&nbsp;&nbsp;人：<input name="o.man" value="${obj.man}"/></p>
	<p>联系电话：<input name="o.phone" value="${obj.phone}"/></p>
</div>
<div style="margin-left:75px;line-height:26px;">
	备注（发票抬头，及其他注意事项）<br>
	<textarea name="o.tip" cols="60" rows="5" >${obj.tip }</textarea>
</div>
<div style="margin-left:75px;line-height:26px;">
	<input type="submit" value="更新订单"/>
</div>

	</form>
</c:if>